/**
 * 
 */

var issueObjId, issueNode;
function otherWorks(e) {
    issueNode = e.currentTarget;
    issueObjId = issueNode.id.split("-")[1];
    // console.log('issue objid:' + issueObjId);
    userObjId = $("#userObjId").val();
    // console.log('user objId: ' + userObjId);
    // check user, how to deal with ajax async?
    issueUserId = $(issueNode).attr('author');
    if (userObjId === issueUserId) return "ready";
    else return "you can not edit others' content"
}

function fnew() {
    window.location.href = "issueEditor.do?objId=-1";
}
function fedit() {
    window.location.href = "issueEditor.do?objId=" + issueObjId;
}
function fdelete() {
    $.ajax({
        method: 'POST',
        url: "issue/deleteIssue.do",
        data: {
            objId: issueObjId
        },
        dataType: 'json',
        success: function (rst) {
            if (rst.success) {
                alert('issue note has been deleted.');
            } else {
                alert('Error,look server output.');
            }
            window.location.href = "main.do";
        }
    })
}